package com.module.my.set.view

import android.content.Intent
import android.net.Uri
import com.module.app.base.BaseFragment
import com.module.app.base.BaseViewModel
import com.module.my.databinding.MyFragSetAppBinding

/**
 * Author: yanxuwen
 * Date: 2023/3/17
 * Desc: 我的其他应用
 */
class SetAppFragment : BaseFragment<BaseViewModel, MyFragSetAppBinding>() {

    override fun bingViewModel() {
        mDatabind.vm = mViewModel
        mDatabind.click = this
    }

    override fun onLazyLoad() {
    }

    fun onClickClub() {
        try {
            val uri = Uri.parse("market://details?id=" + "com.privates.club")
            val intent = Intent(Intent.ACTION_VIEW, uri)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            context?.startActivity(intent)
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }

    fun onClickMood() {
        try {
            val uri = Uri.parse("market://details?id=" + "com.aiyu.mood")
            val intent = Intent(Intent.ACTION_VIEW, uri)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            context?.startActivity(intent)
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }

    fun onClickHomework() {
        try {
            val uri = Uri.parse("market://details?id=" + "com.love.housework")
            val intent = Intent(Intent.ACTION_VIEW, uri)
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
            context?.startActivity(intent)
        } catch (e: Exception) {
            e.printStackTrace()
        }
    }
}